//
//  OPEatDetailNoImgCell.m
//  OnePiece
//
//  Created by wsy on 15/10/28.
//  Copyright © 2015年 wsy. All rights reserved.
//

#import "OPEatDetailNoImgCell.h"

@implementation OPEatDetailNoImgCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor colorWithRed:1.000 green:0.985 blue:0.971 alpha:1.000];
        _content = [[UILabel alloc]init];
        _content.font = [UIFont systemFontOfSize:14];
        _content.numberOfLines = 0;
        _content.textColor = [UIColor colorWithWhite:0.221 alpha:1.000];
        [self.contentView addSubview:_content];
    }
    return self;
}

- (void)setConfigureModel:(OPEatDetailArrayModel *)configureModel
{
    _content.text = configureModel.value;
    _content.frame = CGRectMake(20, 5, SCREEN_WIDTH-40, [OPEatDetailNoImgCell heightOfString:configureModel.value]);
}

+ (CGFloat)heightOfString:(NSString *)str
{
    NSDictionary *dic = [NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:14] forKey:NSFontAttributeName];
    CGRect bounds = [str boundingRectWithSize:CGSizeMake(SCREEN_WIDTH-40, 0) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:dic context:nil];
    return bounds.size.height;
}

+ (CGFloat)heightForCell:(OPEatDetailArrayModel *)model
{
    return 25+[OPEatDetailNoImgCell heightOfString:model.value];
}

@end
